package com.example.demo;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Created by Wen Gao on 2018/5/4.
 */
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
//@MapperScan("com.example.demo.dao.*")
@EnableSwagger2
@EnableCaching
// @SpringBootApplication等于@Configuration + @EnableAutoConfiguration + @ComponentScan
// 如果打war包需要 extends SpringBootServletInitializer并重写configure()方法
public class DemoApp {

    private static final Logger logger = LoggerFactory.getLogger(DemoApp.class);

    public static void main(String[] args) {
        logger.debug("log4j2 -------------- DEBUG");
        logger.info("log4j2 -------------- INFO");
        logger.warn("log4j2 -------------- WARN");
        logger.error("log4j2 -------------- ERROR");
        logger.trace("log4j2 -------------- TRACE");
        SpringApplication springApplication = new SpringApplication(DemoApp.class);
        System.out.println("getWebApplicationType == " + springApplication.getWebApplicationType().name());
        springApplication.run(args);

    }


}
